package com.headline.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.headline.pojo.Type;
import com.headline.pojo.VO.portalSelectVO;
import com.headline.service.TypeService;
import com.headline.mapper.TypeMapper;
import com.headline.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 断念残情
* @description 针对表【news_type】的数据库操作Service实现
* @createDate 2024-04-11 17:20:21
*/
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type>
    implements TypeService{
   @Autowired
   private TypeMapper typeMapper;
    /**
     * 查询所有分类类别
     * @return
     */
    @Override
    public Result findAllTypes() {
        LambdaQueryWrapper<Type> lambdaQueryWrapper
                =new LambdaQueryWrapper<>();
        lambdaQueryWrapper.select(Type::getTid,Type::getTname);
        List<Type> types = typeMapper.selectList(lambdaQueryWrapper);
        return  Result.OK(types);
    }

}




